package com.ruoyi.supervise.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.supervise.domain.BaseCompletionRecordCertInfo;
import com.ruoyi.supervise.domain.ConsturctionCertChangeInfo;
import com.ruoyi.supervise.mapper.BaseCompletionRecordCertInfoMapper;
import com.ruoyi.supervise.service.IBaseCompletionRecordCertInfoService;
import com.ruoyi.supervise.util.XmlReadUtil;

/**
 * @ClassName: BaseCompletionRecordCertInfoServiceImpl
 * @Description: 竣工备案证书impl
 * @Author wtj
 * @DateTime 2020年3月9日 上午10:41:31
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class BaseCompletionRecordCertInfoServiceImpl implements IBaseCompletionRecordCertInfoService 
{
    @Autowired
    private BaseCompletionRecordCertInfoMapper baseCompletionRecordCertInfoMapper;

	@Override
	public BaseCompletionRecordCertInfo selectCompletionRecordCertInfoByGuid(String guid) {
		BaseCompletionRecordCertInfo bcrci = baseCompletionRecordCertInfoMapper.selectCompletionRecordCertInfoByGuid(guid);
		if(bcrci != null && !StringUtils.isEmpty(bcrci.getCompletionRecordChangeInfoList())) {
			ConsturctionCertChangeInfo ccci = new ConsturctionCertChangeInfo();
			ccci.setContent("Content");
			ccci.setModifiedPersonLoginName("ModifiedPersonLoginName");
			ccci.setModifiedPersonRealName("ModifiedPersonRealName");
			ccci.setPubDate("PubDate");
			ccci.setUnitName("UnitName");
			String nodePath = "/PsDataPacket/FDataList/CompletionRecordChangeInfo";
			List<ConsturctionCertChangeInfo> ccciList = XmlReadUtil.getConsturctionCertChangeInfoXml(bcrci.getCompletionRecordChangeInfoList(), nodePath, ccci);
			bcrci.setCompletionCertChangeInfoList(ccciList);
		}
		return bcrci;
	}
}
